Supporting macro definitions

The definition of the active " character needs a couple of support macros. The macro \allowhyphens is used make hyphenation of word possible where it otherwise would be inhibited by TEX. Basically its definition is nothing more than \nobreak \hskip 0pt plus 0pt.

\gdef\allowhyphens{\penalty\@M \hskip\z@skip}

Then a macro is defined to lower the Dutch left double quote to the same level as the comma. It prepares a low double opening quote in box register 0. This macro was copied form german.tex.

\gdef\set@low@box#1{%
    \setbox\tw@\hbox{,} \setbox\z@\hbox{#1}
    \dimen\z@\ht\z@ \advance\dimen\z@ -\ht\tw@
    \setbox\z@\hbox{\lower\dimen\z@ \box\z@}
    \ht\z@\ht\tw@ \dp\z@\dp\tw@}
The macro \set@low@box is used to define low opening quotes. Since it may be used in arguments to other macros it needs to be protected.
\gdef\dlqq{\protect\@dlqq}
\gdef\@dlqq{{%
  \ifhmode
    \edef\@SF{\spacefactor\the\spacefactor}
  \else
    \let\@SF\empty
  \fi
  \leavevmode\set@low@box{''}
  \box\z@\kern-.04em\allowhyphens\@SF\relax}}
For reasons of symmetry we also define "'. This command is defined similar to \dlqq, except that the quotes aren't lowered to the baseline.
\gdef\@drqq{{%
  \ifhmode
    \edef\@SF{\spacefactor\the\spacefactor}
  \else
    \let\@SF\empty
  \fi
  ''\@SF\relax}}
The original double quote character is saved in the macro \dq to keep it available.
\begingroup \catcode`\"12
  \gdef\dq{"}
\endgroup
The original definition of \" is stored as \dieresis. The resason for this is that if a font with a different encoding scheme is used the definition of \" might not be the plain TEX one.
\global\let\dieresis\"

In the Dutch language vowels with a dieresis or umlaut accent are treated specially. If a hyphenation occurs before a vowel-plus-umlaut, the umlaut should disappear. To be able to do this, the hyphenation break behaviour for the five vowels, both lowercase and uppercase, could be defined first in terms of \discretionary. But this results in a large \if-construct in the definition of the active ".

As both Knuth and Lamport have pointed out, a user should not use " when he really means something like ''. For this reason no distinction is made between vowels and consonants. Therefore one macro, \@umlaut, specifies the hyphenation break behaviour for all letters.

\def\@umlaut#1{%
    \allowhyphens%
    \discretionary{-}{#1}{\dieresis #1}%
    \allowhyphens}

The last support macro to be defined is \dutch@active@dq.

\gdef\dutch@active@dq#1{%
     \if\string#1`\dlqq{}%
\else\if\string#1'\drqq{}%
\else\if\string#1-\allowhyphens-\allowhyphens%
\else\if\string#1|\discretionary{-}{}{\kern.03em}%
\else\if\string#1i\allowhyphens\discretionary{-}{i}{\dieresis\i}%
                  \allowhyphens%
\else\if\string#1j\allowhyphens\discretionary{-}{j}{\dieresis\j}%
                  \allowhyphens%
\else \@umlaut{#1}\fi\fi\fi\fi\fi\fi}
The macro reads the next token and performs some appropriate action. If no special action is defined, it will produce an umlaut accent on top of argument 1.

The last definition needed is a replacement for \-. The new version of \- should indicate an extra hyphenation position, while allowing other hyphenation positions to be generated automatically. The standard behaviour of TEX in this respect is very unfortunate for languages such as Dutch and German, where long compound words are quite normal and all one needs is a means to indicate an extra hyphenation position on top of the ones that TEX can generate from the hyphenation patterns.

\def\-{\allowhyphens\discretionary{-}{}{}\allowhyphens}